package com.item.yxlottery.yxlottery.adapter;

/*
 *------------------------------
 * @创建者      Administrator
 * @创建时间    2017/1/3 16:53
 * @文件描述    订单记录adapter
 *------------------------------
 */

import android.content.Context;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.item.yxlottery.yxlottery.R;
import com.item.yxlottery.yxlottery.bean.OrderBean;

import java.util.List;

public class OrderListAdapter extends BaseQuickAdapter<OrderBean, BaseViewHolder> {
    private Context mContext;
    private List<OrderBean> mList;

    public OrderListAdapter(Context context, int layoutResId, List<OrderBean> data) {
        super(layoutResId, data);
        mContext = context;
        mList = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderBean item) {
//        Glide.with(mContext).load(UrlUtil.getImageHomeUrl() + item.getStoreLogo()).into((ImageView) helper.getView(R.id.iv_item_store_image));
        helper.setText(R.id.tv_item_order_lottery, item.getGoodsName())
                .setText(R.id.tv_item_order_issue, item.getLotteryPeriod())
                .setText(R.id.tv_item_order_stakes, item.getLotteryTimes())
                .setText(R.id.tv_item_order_date, item.getCreateTimeString())
                .setText(R.id.tv_item_order_money, item.getOrderTotalPrice());
        View view = helper.getView(R.id.tv_item_order_line);
        //if (item.getOrderState())
        helper.setText(R.id.tv_item_order_state , item.getOrderState());
        if (helper.getAdapterPosition() == mList.size() - 1) {
            view.setVisibility(View.INVISIBLE);
        } else {
            view.setVisibility(View.VISIBLE);
        }

    }
}
